package com.example.mywiseelves.adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.example.mywiseelves.bean.FragmentBean;

import java.util.ArrayList;

/**
 * @author ZJK
 * @data 2021 19
 * @description
 */
public class FragmentAdapter extends FragmentPagerAdapter {
    private ArrayList<FragmentBean> fragments;

    public FragmentAdapter(@NonNull FragmentManager fm, int behavior, ArrayList<FragmentBean> fragments) {
        super(fm, behavior);
        this.fragments = fragments;
    }


    @NonNull
    @Override
    public Fragment getItem(int position) {
        return fragments.get(position).getFragment();
    }

    @Override
    public int getCount() {
        return fragments.size();
    }
}
